import 'package:flutter/material.dart';

class DefaultTabControllerSample extends StatelessWidget {
  final List<Tab> myTabs = <Tab>[
    Tab(
      text: "选项卡一",
    ),
    Tab(
      text: "选项卡二",
    )
  ];

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: "TabController演示",
      home: new DefaultTabController(
          length: myTabs.length,
          child: new Scaffold(
            appBar: AppBar(
              bottom: TabBar(tabs: myTabs),
            ),
            body: TabBarView(
                children: myTabs.map((Tab tab) {
              return new Center(
                child: Text(tab.text + "!!!"),
              );
            }).toList()),
          )),
    );
  }
}
